package com.atguigu.yygh.hosp.controller.api;

import com.alibaba.fastjson.JSONObject;
import com.atguigu.yygh.hosp.repository.HospitalRepository;
import com.atguigu.yygh.hosp.result.Result;
import com.atguigu.yygh.hosp.service.HospitalService;
import com.atguigu.yygh.model.hosp.Hospital;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Map;

@RestController
@RequestMapping("/api/hosp")
public class HospitalApiController {
    @Autowired
    HospitalService hospitalService;


    /**
     * 添加医院管理的接口
     * @param request:医院管理后台数据
     * @return
     */
    @PostMapping("saveHospital")
    public Result saveHospital(HttpServletRequest request) {
        hospitalService.saveHospital(request);
        return Result.ok();
    }
    //http://localhost/api/hosp/hospital/show

    /**
     * 查询医院信息
     * @param request ： HttpServletRequest request
     * @return ：Result。Ok
     */
    @PostMapping("hospital/show")
    public Result getHospital(HttpServletRequest request){
        Result result = hospitalService.getHospital(request);
        return result;
    }

}
